package com.hmall.pojo;

import com.hmall.common.pojo.Item;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 映射索引库
 *
 * @Author 15198
 * @Date 2022/8/10 11:24
 * @Description: 映射索引库
 * @Created by
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ItemDoc {
    private Long id;//商品id
    private String name;//商品名称
    private Long price;//价格（分）
    private String image;//商品图片
    private String category;//分类名称
    private String brand;//品牌名称
    private Integer sold;//销量
    private Integer commentCount;//评论数
    private Boolean isAD;
    private List<String> suggestion = new ArrayList<>(2);

    public ItemDoc(Item item){
        BeanUtils.copyProperties(item,this);
        suggestion.add(item.getBrand());
        suggestion.add(item.getCategory());
    }


}
